//
//  HouseViewController.swift
//  test
//
//  Created by george on 12/23/15.
//  Copyright © 2015 test. All rights reserved.
//

import UIKit

class HouseViewController: UIViewController {

	var house : House?

	var city : UILabel?

	override func viewDidLoad() {
		super.viewDidLoad()
		view.backgroundColor = UIColor.whiteColor()

		if let h = house {
			city = UILabel()
			city?.text = h.city
			view.addSubview(city!)
		}

		self.edgesForExtendedLayout = UIRectEdge.None
	}

	override func viewWillLayoutSubviews() {
		super.viewWillLayoutSubviews()

		if let c = city {
			c.translatesAutoresizingMaskIntoConstraints = false
			view.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("V:|[city]", options: .AlignAllBaseline, metrics: nil, views: ["city":c]))
			view.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|[city]|", options: .AlignAllBaseline, metrics: nil, views: ["city":c]))
		}
	}

}
